rangi = {
[5] = "#a31303Manager",
[4] = "#cc0000RCON",
[3] = "#ff0000Administrator",
[2] = "#006699Moderator",
[1] = "#00CC00Supporter",
}
addCommandHandler('e', function(plr,cmd, ...)
if getAdmin(plr,1) or getAdmin(plr,2) or getAdmin(plr,3) or getAdmin(plr,4) or getAdmin(plr,5) then
if not ... then
  local x = getElementData(plr,"player:ekipaoff")
  if x == false then
	outputChatBox("Wyłączyłeś czat ekipy",plr, 255, 255, 0, true)
	setElementData(plr,"player:ekipaoff",true)
  end
  if x == true then
	outputChatBox("Włączyłeś czat ekipy",plr, 255, 255, 0, true)
	setElementData(plr,"player:ekipaoff",false)
  end
return end
if ... then
if getElementData(plr,"player:ekipaoff") == true then outputChatBox("Posiadasz wyłączone wiadomości tego czatu, nie możesz na nim pisać!", plr, 255, 255, 255) return end
local msg=table.concat({...}, " ")
	ranga = nil
			ranga = rangi[tonumber(getLevel(plr))]
			for _, p in pairs(getElementsByType('player')) do
				if getAdmin(p,1) or getAdmin(p,2) or getAdmin(p,3) or getAdmin(p,4) or getAdmin(p,5) and not getElementData(p,"player:ekipaoff") then
					outputChatBox("[Czat ekipy] #ffffff "..getPlayerName(plr).." | "..ranga..": #ffffff"..msg,p,60,172,120,true)
					exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/e "..msg.."")
				end
			end
		end
	end
end)


------ NOWE -------

addCommandHandler("tt", function(plr,cmd,cel)
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /tt <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr, 255, 0, 0,true)
			return
		end
		if isPedInVehicle(plr) then
			removePedFromVehicle(plr)
		end
		local x,y,z=getElementPosition(target)
		setElementInterior(plr,getElementInterior(target))
		setElementDimension(plr,getElementDimension(target))
		setElementPosition(plr,x+math.random(1,2),y+math.random(1,2),z)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/tt")
	end
end)

addCommandHandler("th", function(plr,cmd,cel)
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /th <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr, 255, 0, 0,true)
			return
		end
		if isPedInVehicle(target) then
			removePedFromVehicle(target)
		end
		local x,y,z=getElementPosition(plr)
		setElementInterior(target,getElementInterior(plr))
		setElementDimension(target,getElementDimension(plr))
		if getElementDimension(plr) == 0 then
			setPlayerHudComponentVisible ( target, "radar", true )
		end
		ranga = rangi[tonumber(getLevel(plr))]
		outputChatBox("#ccc000➤ #ffffff"..ranga.." #808080"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." #ffffffprzeniósł Cię do siebie!", target, 255, 255, 255,true)
		setElementPosition(target,x+math.random(1,2),y+math.random(1,2),z)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/th")
	end
end)

addCommandHandler("warn", function(plr,cmd,cel,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		local reason=table.concat({...}, " ")
		if not cel or not reason then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /warn <nick/ID> <powod>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr, 255, 0, 0,true)
			return
		end
		outputChatBox("===============================", target, 255, 0, 0)
		outputChatBox("Otrzymałeś(aś) ostrzeżenie... ", target, 255, 0, 0)
		outputChatBox("Powód: "..reason.."", target, 255, 0, 0)
		outputChatBox("Nie stosowanie się do ostrzeżeń,", target, 255, 0, 0)
		outputChatBox("Może skutkować kicki'em lub ban'em.", target, 255, 0, 0)
		outputChatBox("===============================", target, 255, 0, 0)
		triggerClientEvent ( root, "dzwiekwarna", target )
		exports["ogrpg-db"]:dbSet("insert into pssm_kartoteka (typ,karajacy,data,powod,ofiara) VALUES(?,?,NOW(),?,?)", "WARN", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason, getElementData(target, "player:uid"))		
		triggerClientEvent(root,"addNotifications",root,"#808080"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."[ID:"..getElementData(target,"id").."] otrzymał(a) ostrzeżenie za #ccc000"..reason.." #808080[#ff0000od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#808080]")		
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/warn")
	end
end)

addCommandHandler("k", function(plr,cmd,cel,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		local reason=table.concat({...}, " ")
		if not cel or not reason then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /k <nick/ID> <powod>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr, 255, 0, 0,true)
			return
		end
		exports["ogrpg-db"]:dbSet("insert into pssm_kartoteka (typ,karajacy,data,powod,ofiara) VALUES(?,?,NOW(),?,?)", "KICK", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason, getElementData(target, "player:uid"))		
		triggerClientEvent(root,"addNotifications",root,"#808080"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."[ID:"..getElementData(target,"id").."] został(a) wyrzucony(a) za #ccc000"..reason.." #808080[#ff0000od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#808080]")		

		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/kick")		
		kickPlayer(target, plr, reason)
	end
end)

addCommandHandler("vtt", function(plr,cmd,vid)
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if not vid or not tonumber(vid) then return end
		vid=tonumber(vid)
		for i,v in ipairs(getElementsByType("vehicle")) do
			local dbid=getElementData(v,"vehicle:id")
			if dbid and tonumber(dbid) == vid then
	    		local x,y,z=getElementPosition(v)
	    		setElementPosition(plr,x,y,z+4)
	    		setElementInterior(plr, getElementInterior(v))
	    		setElementDimension(plr, getElementDimension(v))
			    exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/vtt")		
				if getAdmin(plr,3) then
				warpPedIntoVehicle(plr,v)
				end
	    		return
	    	end
		end
		local query=exports["ogrpg-db"]:dbGet("SELECT 1 FROM ogrpg_vehicles WHERE id=? AND parking>0", vid)
		if query then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Pojazd znajduje się w garażu lub przechowalni.", plr,255,255,255,true)
		else
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego pojazdu na mapie.", plr,255,255,255,true)
		end
	end
end)

addCommandHandler("vth", function(plr,cmd,vid)
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if not vid or not tonumber(vid) then return end
		vid=tonumber(vid)
		for i,v in ipairs(getElementsByType("vehicle")) do
			local dbid=getElementData(v,"vehicle:id")
			if dbid and tonumber(dbid) == vid then
				if getElementData(v,"vehicle:police_parking") then outputChatBox("#BC8F8F[DUTY]#FFFFFF Pojazd znajduje się na parkingu policyjnym.", plr,255,0,0,true) return end
	    		local x,y,z=getElementPosition(plr)
	    		setElementPosition(v,x,y,z+0.1)
	    		setElementInterior(v, getElementInterior(plr))
	    		setElementDimension(v, getElementDimension(plr))
				exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/vth")		
				if getAdmin(plr,3) then
				warpPedIntoVehicle(plr,v)
				end
	    		return
	   		end
		end
		local query=exports["ogrpg-db"]:dbGet("SELECT 1 FROM ogrpg_vehicles WHERE id=? AND parking>0", vid)
		if query then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Pojazd znajduje się w garażu lub przechowalni.", plr,255,255,255,true)
		else
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego pojazdu na mapie.", plr,255,255,255,true)
		end
	end
end)

addCommandHandler("inv", function(plr)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if getElementAlpha(plr) > 0 then
			setElementAlpha(plr,0)
			setElementData(plr,"player:inv",true)
		else
			setElementAlpha(plr,255)
			setElementData(plr,"player:inv",false)
		end
	end
end)

addCommandHandler("inf", function(plr,cmd,...)
	if not getElementData(plr, "player:admin") then return end
	if getAdmin(plr,5) then
		local text=table.concat({...}, " ")
		outputChatBox(">INFO< #ffffff"..text, root, 0, 255, 255,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/inf "..text.."")		
	end
end)

addCommandHandler("c", function(plr,cmd,...)
	if not getElementData(plr, "player:admin") then return end
	if getAdmin(plr,5) then
		local text=table.concat({...}, " ")
		outputChatBox(">> "..text.." #ffffff- "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), root, 64, 96, 224,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/c "..text.."")
	end
end)

addCommandHandler("r", function(plr,cmd,...)
	if not getElementData(plr, "player:admin") then return end
	if getAdmin(plr,5) or getAdmin(plr,4) then
		local text=table.concat({...}, " ")
		outputChatBox(">> "..text.." #ffffff- "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), root, 100, 0, 0,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/r "..text.."")
	end
end)

addCommandHandler("a", function(plr,cmd,...)
	if not getElementData(plr, "player:admin") then return end
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) then
		local text=table.concat({...}, " ")
		outputChatBox(">> "..text.." #ffffff- "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), root, 255, 0, 0,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/a "..text.."")
	end
end)

addCommandHandler("m", function(plr,cmd,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) then
		local text=table.concat({...}, " ")
		outputChatBox(">> "..text.." #ffffff- "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), root, 0, 102, 0,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/m "..text.."")
	end
end)

addCommandHandler("daj.kase", function(plr,cmd,cel,value)
	if not getElementData(plr, "player:admin") then return end	
	if getPlayerSerial(plr) == "508A52AA1DA1FF5FCC5C344CAC3812A1" then
		if not cel or not tonumber(value) then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /daj.kase <nick/ID> <ile>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		givePlayerMoney(target,value*100)
		outputChatBox("Otrzymałeś #00ff00"..value.." PLN#ffffff od #ff0000AmaMa.", target,255,255,255,true)
		outputChatBox("#BC8F8F[DUTY]#FFFFFF Nadałeś #00ff00"..value.." PLN#ffffff dla gracza #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x",""), plr,255,255,255,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/daj.kase "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." "..value.."")
	end
end)

addCommandHandler("daj.reputacje", function(plr,cmd,cel,value,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) then
		local reason=table.concat({...}, " ")
		if not cel or not tonumber(value) then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /daj.reputacje <nick/ID> <ilosc>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET reputation=? WHERE id=?", getElementData(target,"player:reputation")+value, getElementData(target, "player:uid"))
		setElementData(target,"player:reputation", getElementData(target,"player:reputation")+value)
		outputChatBox("Otrzymałeś #00ff00"..value.." reputacji #ffffff od #ff0000"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target,255,255,255,true)
		outputChatBox("#BC8F8F[DUTY]#FFFFFF Nadałeś #00ff00"..value.." reputacji#ffffff dla gracza #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x",""), plr,255,255,255,true)
		triggerClientEvent(root,"addNotifications",root,"#00ff00 "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzymał(a) "..value.." reputacji od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."")
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/daj.reputacje "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." "..value.."")
	end
end)

addCommandHandler("zablokuj", function(plr,cmd,cel,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) then
		local reason=table.concat({...}, " ")
		if not cel or not reason then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /zablokuj <nick/ID> <powód>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		reason2 = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
		exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET blokada=1 WHERE id=?", getElementData(target,"player:uid"))
		exports["ogrpg-db"]:dbSet("insert into pssm_kartoteka (typ,karajacy,data,powod,ofiara) VALUES(?,?,NOW(),?,?)", "BAN", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason, getElementData(target, "player:uid"))		
		triggerClientEvent(root,"addNotifications",root,"#FF0000 Gracz "..getPlayerName(target).." został(a) zablokowany(a) za: "..reason2.."")		
		kickPlayer(target,plr,"Twoje konto zostało zablokowane, połącz się ponownie.")
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/zablokuj "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." "..reason.."")
	end
end)

addCommandHandler("heal", function(plr,cmd,cel)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or  getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /heal <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		setElementHealth(target, 100)
		outputChatBox("Zostałeś(aś) uleczony(a) przez #ff0000"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target,255,255,255,true)
		outputChatBox("#BC8F8F[DUTY]#FFFFFF Uleczyłeś(aś) gracza #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x",""), plr,255,255,255,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/heal "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."")
	end
end)

addCommandHandler("jp", function(plr,cmd)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if isPedInVehicle(plr) then
			removePedFromVehicle(plr)
		end
		if doesPedHaveJetPack(plr) then
			removePedJetPack(plr)
		else
			givePedJetPack(plr)
			exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/jp")
		end
	end
end)

local zablokowane ={
['hydra'] = true,
['police lv'] = true,
['police ls'] = true,
['police sf'] = true,
['elegant'] = false,
['rhino'] = true,
['seasparrow'] = true,
['hunter'] = true,
['police'] = true,
['hotring racer 2'] = true,
}

addCommandHandler("p", function(plr, cmd, ...)
   if not getElementData(plr, "player:admin") then return end
   if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) then
        if (not ...) then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /p <model>", plr,255,255,255,true)
            return
        end
		local model = table.concat ( { ... }, " " )
		if tonumber(model) ~= nil then
		outputChatBox("#BC8F8F[DUTY]#FF0000 Nazwa to nie ID.", plr,255,255,255,true)
		return end
		local model  = model:lower()
		if zablokowane[model] then
		return end
        local dim = getElementDimension(plr)
        local x,y,z = getElementPosition(plr)
        local r1,r2,r3 = getElementRotation(plr)
        local model = getVehicleModelFromName(model)
		if not model then outputChatBox("#BC8F8F[DUTY]#FF0000 Nie ma modelu o takiej nazwie.", plr,255,255,255,true) return end
        local vehicle = getPedOccupiedVehicle(plr)
        if getPedOccupiedVehicle(plr) then
		outputChatBox("*Nie mozesz podmienic!" , plr , 255, 0 ,0)
        else
            pojazd = createVehicle(model, x, y, z, r1, r2, r3)
            warpPedIntoVehicle(plr, pojazd)
            setElementDimension(pojazd, dim)
			setElementPosition(plr,x, y, z+1.5)
			setElementData(pojazd,"nalezy",getElementData(plr,"player:uid"))
			setVehiclePlateText(pojazd, "RESPIONY")
			exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/p "..model.."")
			addEventHandler("onVehicleExit", pojazd, function(plr,seat)
			if seat ~= 0 then return end
			destroyElement(source)
			end)			
        end
	else
    end
end)

addCommandHandler("daj.kase.wszystkim", function(plr,cmd,pinion)
	if not getElementData(plr, "player:admin") then return end	
	if not pinion then return end
	if not tonumber(pinion) then return end
	if getPlayerSerial(plr) == "508A52AA1DA1FF5FCC5C344CAC3812A1" then
		for i,v in ipairs(getElementsByType("player")) do
		if isElement(v) then
		givePlayerMoney(v,pinion*100)
		end
		end
	    outputChatBox("#ff0000B#ccc000O#00ff00N#00ffffU#FF00FFS#FFFFFF Otrzymano #00ff00"..pinion.." PLN#ffffff od właściciela #ff0000AmaMa.", root, 255,0,0,true)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/daj.kase.wszystkim "..pinion.."")
	end
end)




addCommandHandler("zpj", function(plr,cmd,cel,time,rodzaj,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		local reason=table.concat({...}, " ")
		if not cel or not tonumber(time) or not rodzaj or not reason then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /zpj <nick/ID> <czas> <jednostka: m/h/d> <powód>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		local result = exports["ogrpg-db"]:dbGet("SELECT * FROM pssm_punish WHERE type=? AND active=1 AND serial=? LIMIT 1","zpj", getPlayerSerial(target))
		if result and #result > 0 then
			return outputChatBox("#BC8F8F[DUTY]#FFFFFF Gracz Posiada zawieszone prawo jazdy do #ff0000"..result[1]["time"].."#ffffff za: #ff0000"..result[1]["reason"], plr, 255, 0, 0,true)
		end
			exports["ogrpg-db"]:dbSet("insert into pssm_kartoteka (typ,karajacy,data,powod,ofiara) VALUES(?,?,NOW(),?,?)", "ZPJ", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason, getElementData(target, "player:uid"))
		if isPedInVehicle(target) then
			removePedFromVehicle(target)
		end
		if tonumber(time) <= 0 then return end
		local reason = reason.." #808080[#ff0000od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#808080]"
		if rodzaj == "m" then
		if time == "1" then trodzaj = "minutę" elseif time == "2" or time == "3" or time == "4" then trodzaj = "minuty" else trodzaj = "minut" end	
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_punish (serial,uid,reason,time,type) VALUES (?,?,?,NOW() + INTERVAL ? minute,?)", getPlayerSerial(target),getElementData(target, "player:uid"),reason:gsub("#%x%x%x%x%x%x",""), time, "zpj")
		elseif rodzaj == "h" then
		if time == "1" then trodzaj = "godzinę" elseif time == "2" or time == "3" or time == "4" then trodzaj = "godziny" else trodzaj = "godzin" end	
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_punish (serial,uid,reason,time,type) VALUES (?,?,?,NOW() + INTERVAL ? hour,?)", getPlayerSerial(target),getElementData(target, "player:uid"),reason:gsub("#%x%x%x%x%x%x",""), time, "zpj")
		elseif rodzaj == "d" then
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_punish (serial,uid,reason,time,type) VALUES (?,?,?,NOW() + INTERVAL ? day,?)", getPlayerSerial(target),getElementData(target, "player:uid"),reason:gsub("#%x%x%x%x%x%x",""), time, "zpj")
		if time == "1" then trodzaj = "dzień" else trodzaj = "dni" end	
		end
		triggerClientEvent(root,"addNotifications",root,"#808080"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."[ID:"..getElementData(target,"id").."] otrzymał(a) zakaz prowadzenia pojazdów na #ccc000"..time.." "..trodzaj.." #808080za #ccc000"..reason.."")		
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/zpj "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." "..time.." "..trodzaj.." "..reason:gsub("#%x%x%x%x%x%x","").."")
	end
end)

addCommandHandler("opj", function(plr,cmd,cel)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /opj <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		if target == plr then outputChatBox("#BC8F8F[DUTY]#ff0000 Nie możesz sobie oddać prawa jazdy.", plr,255,255,255,true) return end
		local result = exports["ogrpg-db"]:dbGet("SELECT * FROM pssm_punish WHERE type=? AND active=1 AND serial=? AND time>NOW() LIMIT 1","zpj", getPlayerSerial(target))
		    if result and #result > 0 then
			exports["ogrpg-db"]:dbSet("DELETE FROM pssm_punish WHERE type=? AND active=1 AND serial=?", "zpj", getPlayerSerial(target))
			outputChatBox("#ff0000"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." #ffffff oddał twoje prawo jazdy.", target,255,255,255,true)
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Pomyślnie oddano prawo jazdy graczowi #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x",""),plr,255,255,255,true)
			exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/opj "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."")
		else
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Gracz #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."#ffffff nie ma zabranego prawa jazdy.",plr,255,255,255,true)

		end
	end
end)

addCommandHandler("checkserial", function(plr,cmd,cel)
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /checkserial <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		outputChatBox("#BC8F8F[DUTY]#FFFFFF Serial gracza: #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." #ffffffto #ccc000"..getPlayerSerial(target).."", plr, 255, 0, 0,true)
	end
end)

addCommandHandler("b", function(plr,cmd,cel,x,bantype,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) then
		local reason=table.concat({...}, " ")
		if not cel or not tonumber(x) or not bantype or not reason then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /b <nick/ID> <czas> <jednostka: m/h/d> <powód>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		local reason = reason.." #808080[#ff0000od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#808080]"
		if bantype=="m" or bantype=="h" or bantype=="d" then
		if bantype=="m" then
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_bans (serial,reason,time,type,uid) VALUES (?,?,NOW() + INTERVAL ? minute,?,?)", getPlayerSerial(target),reason:gsub("#%x%x%x%x%x%x",""), x, "ban",getElementData(target,"player:uid"))
		end
		if bantype=="h" then
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_bans (serial,reason,time,type,uid) VALUES (?,?,NOW() + INTERVAL ? hour,?,?)", getPlayerSerial(target),reason:gsub("#%x%x%x%x%x%x",""), x, "ban",getElementData(target,"player:uid"))
		end
		if bantype=="d" then
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_bans (serial,reason,time,type,uid) VALUES (?,?,NOW() + INTERVAL ? day,?,?)", getPlayerSerial(target),reason:gsub("#%x%x%x%x%x%x",""), x, "ban",getElementData(target,"player:uid"))
		end
		end
		exports["ogrpg-db"]:dbSet("insert into pssm_kartoteka (typ,karajacy,data,powod,ofiara) VALUES(?,?,NOW(),?,?)", "BAN", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason:gsub("#%x%x%x%x%x%x",""), getElementData(target, "player:uid"))		
		triggerClientEvent(root,"addNotifications",root,"#808080"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."[ID:"..getElementData(target,"id").."] został zbanowany na #ccc000"..x.." "..bantype.." #808080za #ccc000"..reason.."")		
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/b "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." "..x.." "..bantype.." "..reason:gsub("#%x%x%x%x%x%x","").."")
		kickPlayer(target,plr,"Zostałeś zbanowany, połącz się ponownie.")
	end
end)

addCommandHandler("ub", function(plr,cmd,cel)
	if not getElementData(plr, "player:admin") then return end	
		if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /ub <serial>", plr,255,255,255,true)
			return
		end
		local result = exports["ogrpg-db"]:dbGet("SELECT * FROM pssm_bans WHERE type=? AND active=1 AND serial=? AND time>NOW() LIMIT 1","ban", cel)
		if result and #result > 0 then
			exports["ogrpg-db"]:dbSet("DELETE FROM pssm_bans WHERE type=? AND active=1 AND serial=?", "ban", cel)
			exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/ub "..cel.."")
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Pomyślnie usunięto bana dla serialu "..cel.."",plr,255,255,255,true)
		else
			outputChatBox("#BC8F8F[DUTY]#ff0000 Nie wykryto bana dla serialu "..cel.."",plr,255,255,255,true)
		end
	end
end)

addCommandHandler("spec", function(plr,cmd,cel)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2)or getAdmin(plr,1) then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /spec <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		local x,y,z=getElementPosition(plr)
		removePedFromVehicle(plr)
		setElementInterior(plr, getElementInterior(target))
		setElementDimension(plr, getElementDimension(target))
		setCameraTarget(plr, target)
		setElementFrozen(plr,true)
		toggleAllControls(plr,false)
		toggleControl(plr,"chatbox",true)
		toggleControl(plr,"screenshot",true)
		if getElementAlpha(plr) > 0 then
			setElementAlpha(plr,0)
			setElementData(plr,"player:inv",true)
        end
		setElementData(plr,"spec:pos",{x,y,z})
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/spec "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."")
	end
end)

addCommandHandler("specoff", function(plr,cmd)
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		local spec=getElementData(plr,"spec:pos")
		if not spec then return end
		setElementPosition(plr, spec[1], spec[2], spec[3])
		setElementData(plr,"spec:pos",nil)
		setCameraTarget(plr, plr)
		setElementFrozen(plr,false)
		toggleAllControls(plr,true)
		setElementAlpha(plr,255)
		setElementData(plr,"player:inv",false)
	end
end)

function flip(plr,cmd)
	if getElementData(plr,"blokadaflip") then return outputChatBox("#ff0000Możesz obrócić swój pojazd tylko raz na minutę!",plr,255,255,255,true) end
		local veh = getPedOccupiedVehicle(plr)
		if not veh then return end
		local x,y,z = getElementRotation(veh)
		setElementRotation( veh,0,0,z)
		setElementData(plr,"blokadaflip",true)
	    setTimer(function()
	        if getElementData(plr,"blokadaflip") then
	        setElementData(plr,"blokadaflip",false)
        	end
     	end, 60000, 1)
end
addCommandHandler ( "obroc", flip )
addCommandHandler ( "ob", flip )
addCommandHandler ( "op", flip )

addCommandHandler("wycisz", function(plr,cmd,cel,time,rodzaj,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
		local reason=table.concat({...}, " ")
		if not cel or not tonumber(time) or not rodzaj or not reason then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /wycisz <nick/ID> <czas> <jednostka: m/h/d> <powód>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		local result = exports["ogrpg-db"]:dbGet("SELECT * FROM pssm_punish WHERE type=? AND active=1 AND serial=? LIMIT 1","mute", getPlayerSerial(target))
		if result and #result > 0 then
			return outputChatBox("#BC8F8F[DUTY]#FFFFFF Gracz Posiada wyciszenie do #ff0000"..result[1]["time"].."#ffffff za: #ff0000"..result[1]["reason"], plr, 255, 0, 0,true)
		end
		exports["ogrpg-db"]:dbSet("insert into pssm_kartoteka (typ,karajacy,data,powod,ofiara) VALUES(?,?,NOW(),?,?)", "MUTE", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason, getElementData(target, "player:uid"))
		setElementData(target,"gracz:mute",true)
	    setElementData ( target, "player:duty",nil )
		if getElementData(target,"player:admin") then
	    setElementCollisionsEnabled ( target, true )
	    setElementData ( target, "player:level",nil )
		setElementData(target,"player:admin",nil)
		setElementData(target,"nazero",false)
		triggerClientEvent(target,"zabierzzeroadmina",resourceRoot)
		end
		if tonumber(time) <= 0 then return end
		local reason = reason.." #808080[#ff0000od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#808080]"
		if rodzaj == "m" then
		if time == "1" then trodzaj = "minutę" elseif time == "2" or time == "3" or time == "4" then trodzaj = "minuty" else trodzaj = "minut" end	
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? minute,?)", getPlayerSerial(target),reason, time, "mute")
		elseif rodzaj == "h" then
		if time == "1" then trodzaj = "godzinę" elseif time == "2" or time == "3" or time == "4" then trodzaj = "godziny" else trodzaj = "godzin" end	
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? hour,?)", getPlayerSerial(target),reason, time, "mute")
		elseif rodzaj == "d" then
		if time == "1" then trodzaj = "dzień" else trodzaj = "dni" end	
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? day,?)", getPlayerSerial(target),reason, time, "mute")
		end
		triggerClientEvent(root,"addNotifications",root,"#808080"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."[ID:"..getElementData(target,"id").."] otrzymał(a) wyciszenie czatu na #ccc000"..time.." "..trodzaj.." #808080za #ccc000"..reason.."")		
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/wycisz "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." "..time.." "..trodzaj.." "..reason:gsub("#%x%x%x%x%x%x","").."")
	end
end)



addCommandHandler("odcisz", function(plr,cmd,cel)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		if not cel then
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Użycie: /odcisz <nick/ID>", plr,255,255,255,true)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("#BC8F8F[DUTY]#FF0000 Nie znaleziono podanego gracza.", plr,255,255,255,true)
			return
		end
		if target == plr then outputChatBox("#BC8F8F[DUTY]#ff0000 Nie możesz odciszyć samego siebie.", plr,255,255,255,true) return end
		local result = exports["ogrpg-db"]:dbGet("SELECT * FROM pssm_punish WHERE type=? AND active=1 AND serial=? AND time>NOW() LIMIT 1","mute", getPlayerSerial(target))
		    if result and #result > 0 then
			exports["ogrpg-db"]:dbSet("DELETE FROM pssm_punish WHERE type=? AND active=1 AND serial=?", "mute", getPlayerSerial(target))
			outputChatBox("#ff0000"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." #ffffff zdjął twoje wyciszenie na czat.", target,255,255,255,true)
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Pomyślnie odciszono gracza #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x",""),plr,255,255,255,true)
			exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/odcisz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."")
			setElementData(target,"gracz:mute",false)
		else
			outputChatBox("#BC8F8F[DUTY]#FFFFFF Gracz #ff0000"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."#ffffff nie jest wyciszony.",plr,255,255,255,true)

		end
	end
end)

addCommandHandler("fix", function(plr,cmd)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		local veh=getPedOccupiedVehicle(plr)
		if not veh then
			outputChatBox("#BC8F8F[DUTY]#ff0000 Nie znajdujesz się w pojeździe.", plr,255,255,255,true)
			return
		end
		if getPlayerMoney(plr) < 15000 then outputChatBox("#BC8F8F[DUTY]#ff0000 Musisz mieć 150 PLN na naprawę.", plr,255,255,255,true) return end
		outputChatBox("#BC8F8F[DUTY]#00ff00 Pojazd został naprawiony, a z twojego konta pobrane 150 PLN.", plr,255,255,255,true)
		setElementHealth(veh, 1000)
		fixVehicle(veh)
		takePlayerMoney(plr,15000)
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/fix")
	end
end)

addCommandHandler("paliwo", function(plr,cmd)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1)then
		local veh=getPedOccupiedVehicle(plr)
		if not veh then
			outputChatBox("#BC8F8F[DUTY]#ff0000 Nie znajdujesz się w pojeździe.", plr,255,255,255,true)
			return
		end
		local bak = getElementData(veh,"vehicle:tank")
		if bak == 25 then
		if getPlayerMoney(plr) < 14000 then return end
		setElementData(veh, "vehicle:fuel", 25)
		outputChatBox("#BC8F8F[DUTY]#00ff00 Pojazd został zatankowany, a z twojego konta pobrane 140 PLN.", plr,255,255,255,true)
		takePlayerMoney(plr,14000)
		elseif bak == 35 then
		if getPlayerMoney(plr) < 19000 then return end
		setElementData(veh, "vehicle:fuel", 35)
		outputChatBox("#BC8F8F[DUTY]#00ff00 Pojazd został zatankowany, a z twojego konta pobrane 190 PLN.", plr,255,255,255,true)
		takePlayerMoney(plr,19000)		
		elseif bak == 50 then
		if getPlayerMoney(plr) < 27500 then return end
		setElementData(veh, "vehicle:fuel", 50)
		outputChatBox("#BC8F8F[DUTY]#00ff00 Pojazd został zatankowany, a z twojego konta pobrane 275 PLN.", plr,255,255,255,true)
		takePlayerMoney(plr,27500)
		end
		exports["ogrpg-db"]:dbSet("INSERT INTO pssm_logs_admincmd (nameadmin,uid,cmd) VALUES (?,?,?)", getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:uid"), "/paliwo")
	end
end)




------ NOWE --------

















































--[[

addCommandHandler("skin", function(plr,cmd,cel,id)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr) then
		local id = tonumber(id)
		if not cel or not id then
			outputChatBox("* Użycie: /skin <nick/ID> <id skinu> ", plr)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
			return
		end
		if id == 135 or id == 2 or id == 19 or id == 205 or id == 45 or id == 99 or id == 210 or id == 212 or id == 215 or id == 218 or id == 220 or id == 117 or id == 136 or id == 137 or id == 160 or id == 167 or id == 204 or id == 210 or id == 234  or id == 236 or id == 235 or id == 199 or id == 207 or id == 232 or id == 132 or id == 168 or id == 182 or id == 209 or id == 213 or id == 228 or id == 238 or id == 243 or id == 247 or id == 248 or id == 254 or id == 261 or id == 262 or id == 143 then outputChatBox("Nie możesz używać tego skina!",plr) return end
		if id < 0 or id > 311 then outputChatBox("* Użycie: /skin <nick/ID> <id skinu>", plr) return end
		if id == 257 then outputChatBox("Tylko dla AmaMy :3",plr) return end
		if id == 295 or id == 297 then outputChatBox("Ten skin jest zakazany przez rząd ASA.",plr) return end
		setElementModel(target,id)
		local query = exports['ogrpg-db']:dbSet("UPDATE ogrpg_users SET skin=? WHERE id=?",id,getElementData(target,"player:uid"))
		outputChatBox("*Zmieniono skin graczu "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." na id "..id,plr)
	end
end)

addCommandHandler("turbo", function(plr,cmd,cel,value)
		if not getElementData(plr, "player:admin") then return end	
		if getAdmin(plr,3) or getAdmin(plr,5) then
		local pojazd = getPedOccupiedVehicle(plr)
		if getElementData(pojazd,"vehicle:id") then return end
		if getVehiclePlateText(pojazd, "RESPIONY") then
        outputChatBox("* Zamontowałeś(aś) układ Turbo.", plr)
	    setVehicleHandling(pojazd, "engineAcceleration", getVehicleHandling ( pojazd ).engineAcceleration + 4 )
	    setVehicleHandling(pojazd, "maxVelocity", getVehicleHandling ( pojazd ).maxVelocity + 35 )
        setVehicleHandling(pojazd, "tractionMultiplier", 0.8)
        setVehicleHandling(pojazd, "steeringLock", 50)
		setVehicleHandling(pojazd, "driveType", "awd")
		end
	end
end)

addCommandHandler("cfix", function(plr, cmd, range)
    if not getElementData(plr, "player:admin") then return end
	if getAdmin(plr,5) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        if (not range) then
            outputChatBox("Użyj: /cfix <zasieg>", plr)
        return end
		if not tonumber(range) then
		outputChatBox("* /cfix <zasieg>", plr)
		return end
		range = tonumber(range)
		if range <= 0 then
		outputChatBox("* Za mala odleglosc", plr)
		return end
		if range > 50 then
		outputChatBox("* Za duza odleglosc", plr)
		return end
		local x,y,z = getElementPosition(plr)
		local cub = createColSphere(x,y,z,range)
		local pojazdy = getElementsWithinColShape( cub, "vehicle")
		if #pojazdy == 0 then
		outputChatBox("* Brak pojazdow w poblizu", plr)
		return end
		for i,pojazd in ipairs(pojazdy) do
			fixVehicle(pojazd)
		end
		setTimer(destroyElement,5000,1,cub)
	end
end)

addCommandHandler("up", function(plr, cmd, value)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        if (tonumber(value)==nil) then
            outputChatBox("Użyj: /up <ile>", plr)
            return
        end

        local e = plr

        if (isPedInVehicle(plr)) then
            e = getPedOccupiedVehicle(plr)
        end

        local x,y,z = getElementPosition(e)
        setElementPosition(e, x, y, z+tonumber(value))
    end
end)

addCommandHandler("thru", function(plr, cmd, value)
	if not getElementData(plr, "player:admin") then return end	
	if getElementData(plr,"player:job") then return end
	if getAdmin(plr,5) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        if (tonumber(value)==nil) then
            outputChatBox("Użyj: /thru <ile>", plr)
            return
        end

        local e = plr

        if getCameraTarget(plr) ~= plr then
            e = getCameraTarget(plr)
        end

        if (isPedInVehicle(plr)) then
            e = getPedOccupiedVehicle(e)
        end

        local x,y,z = getElementPosition(e)
        local _,_,rz = getElementRotation(e)

        local rrz = math.rad(rz)
        local x = x + (value * math.sin(-rrz))
        local y = y + (value * math.cos(-rrz))

        setElementPosition(e, x, y, z)
    end
end)

function flip(plr)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr) then
		if isPedInVehicle(plr) then
			local veh = getPedOccupiedVehicle( plr )
			local x,y,z = getElementRotation(veh)
			setElementRotation( veh,0,0,z)
			exports["ogrpg-db"]:dbSet("INSERT INTO admin_logs_cmd (uid,moderator,cmd) VALUES (?,?,?)", getElementData(plr,"player:uid"), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), "flip")
       end
	end
end
addCommandHandler('flip',flip)


function ztp(plr)
if not getElementData(plr, "player:admin") then return end	
setElementPosition(plr,-4569.85, 2876.00, 7.46)
end
addCommandHandler('ztp',ztp)





elektrytki = {
[507] = true,
[503] = true,
}

addCommandHandler("dajbron", function(plr,cmd,cel,bron,amunicja)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,3) or getPlayerSerial(plr) == "CE4B6DDDE1828F60DB3F659932827553" then
		if not cel or not bron then
			outputChatBox("* Użycie: /dajbron <nick/ID> <bron > <amunicja>", plr)
			return
		end
		if not tonumber(bron) then
		outputChatBox("* Użycie: /dajbron <nick/ID> <bron > <amunicja>", plr)
			return
		end
		if not amunicja then local amunicja = 10 end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
			return
		end
		if giveWeapon(target,bron,amunicja,true) then
			outputChatBox(" * Nadałeś bron ("..getWeaponNameFromID(bron)..") dla "..getPlayerName(target):gsub("#%x%x%x%x%x%x",""),plr)
			outputChatBox(" * Otrzymales bron ("..getWeaponNameFromID(bron)..") od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""),target)
			exports["ogrpg-db"]:dbSet("INSERT INTO admin_logs_cmd (uid,moderator,cmd) VALUES (?,?,?)", getElementData(plr,"player:uid"), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), "bron")
		else
			outputChatBox(" * Wpisaleś złe ID ĆWOKU!",plr)
		end
	end
end)

addCommandHandler("pochwal", function(plr,cmd,cel,...)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,3) or getAdmin(plr, 2) or getAdmin(plr, 1) then
		local reason=table.concat({...}, " ")
		if not cel or not reason then
			outputChatBox("* Użycie: /pochwal <nick/ID> <powód>", plr)
			return
		end
		local target=exports["ogrpg-core"]:findPlayer(plr,cel)
		if not target then
			outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
			return
		end
		outputChatBox("* Otrzymałeś(aś)  pochwałę od administracji!!", target)
		outputChatBox ("Nadałeś(aś) pochwałę dla gracza "..getPlayerName(target):gsub("#%x%x%x%x%x%x",""),plr)
		triggerClientEvent(root, "admin:rendering2", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzymał(a) pochwałę od administratora: '"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."' z powodu: "..reason.."")
		exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_pochwaly (uid,kto_dostal,kto_dal,reason) VALUES (?,?,?,?)", getElementData(target,"player:uid"), getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), reason)
	end

end)

addCommandHandler("doprzecho", function(plr,cmd,auto)
	if not getElementData(plr, "player:admin") then return end	
	if getAdmin(plr,5) or getAdmin(plr,3) or getAdmin(plr, 2) or getAdmin(plr,1) then

    if not auto or not tonumber(auto) then
	    outputChatBox("#FA8072[DUTY]#FFFFFF Użyj: /doprzecho <id pojazdu>",plr,255,255,255,true)
        return
    end
    auto=tonumber(auto)
	
	local result = exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=?",auto)
	if result[1].parking == 1 or result[1].police == 1 then
	outputChatBox("#FA8072[DUTY]#FFFFFF Pojazd o ID: "..auto.." nie znajduje się na mapie!",plr,255,255,255,true)
	return end
	for i,v in ipairs(getElementsByType("vehicle")) do
		if getElementData(v, "vehicle:id") and getElementData(v, "vehicle:id") == auto then
		if getVehicleOccupant(v) then outputChatBox("#FA8072[DUTY]#FFFFFF Pojazd o ID: "..auto.." ma aktualnie kierowcę!",plr,255,255,255,true) return end
			exports["ogrpg-vehicles"]:onSaveVehicle(v)
			destroyElement(v)
		    local wyk = exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1 WHERE id=?", auto)
	        outputChatBox("#FA8072[DUTY]#FFFFFF Pomyślnie przeniesiono pojazd o ID: "..auto.." do przechowalni.",plr,255,255,255,true)
		end
	end
	end
end)
		
]]